<template>
  <div class="tar-bar">
    <div class="tar-list">
      <div class="tar-item" @click="toggleSubCategory('nexhibition')">
        <div class="pic">
          <img src="@/assets/goImages/zhanlan.jpg" alt="" />
        </div>
        <div class="mask" :class="{ zl: sub_category == 'nexhibition' }"></div>
      </div>
      <div class="tar-item" @click="toggleSubCategory('ndrama')">
        <div class="pic">
          <img src="@/assets/goImages/hauju.jpg" alt="" />
        </div>
        <div class="mask" :class="{ hj: sub_category == 'ndrama' }"></div>
      </div>
      <div class="tar-item" @click="toggleSubCategory('nticket')">
        <div class="pic">
          <img src="@/assets/goImages/jingdian.jpg" alt="" />
        </div>
        <div class="mask" :class="{ jd: sub_category == 'nticket' }"></div>
      </div>
      <div class="tar-item" @click="toggleSubCategory('noutdoor')">
        <div class="pic">
          <img src="@/assets/goImages/yundong.jpg" alt="" />
        </div>
        <div class="mask" :class="{ yd: sub_category == 'noutdoor' }"></div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    sub_category: String
  },
  methods: {
    toggleSubCategory(category) {
      this.$emit('toggle-category', category)
    }
  }
}
</script>

<style lang="less" scoped>
.tar-bar {
  margin-top: 10px;
  background-color: #fff;

  .tar-list {
    padding: 0 10px 10px;
    display: flex;

    justify-content: space-around;

    .tar-item {
      height: 24vw;
      width: 24vw;
      position: relative;
      display: flex;
      justify-content: center;
      align-items: center;

      .pic {
        img {
          height: 55px;
          width: 55px;
        }
      }

      .mask {
        position: absolute;
        height: 90%;
        width: 90%;
        top: 50%;
        left: 50%;
        transform: translateX(-50%) translateY(-50%);
        border-radius: 5px;
        opacity: 0.6;

        &.zl {
          background-color: #feeae1;
        }
        &.hj {
          background-color: #f5f7e4;
        }
        &.jd {
          background-color: #e3f0f9;
        }
        &.yd {
          background-color: #feeade;
        }
      }
    }
  }
}
</style>
